package AdminControl;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Model.Mobile;

/**
 * Servlet implementation class InfoProduct
 */
public class InfoProduct extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public InfoProduct() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		try {
			String mobileid= request.getParameter("mobileID");
			
			
			int mid=Integer.parseInt(mobileid);
			
			Mobile m=new Mobile();
			 Mobile mb=(Mobile)m.getSanPham(mid);
			// int carid=mb.getCatId(mid);
		//	 String a=Integer.toString(carid);
		
		
		
		 request.setAttribute("mb", mb);
		// request.setAttribute("a", a);
		} catch (Exception e) {
			// TODO: handle exception
		}
		
	        RequestDispatcher re = getServletContext().getRequestDispatcher("/Admin/UpdateProduct.jsp");
	        re.forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
